package com.movitech.mobile.cz.base.supplier.service.impl;

import com.movitech.mobile.cz.base.supplier.entity.SCommentConfig;
import com.movitech.mobile.cz.base.supplier.entity.ext.SCommentConfigFindRequest;
import com.movitech.mobile.cz.base.supplier.mapper.SCommentConfigMapper;
import com.movitech.mobile.cz.base.supplier.service.SCommentConfigService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 文本内容配置表 服务实现类
 * </p>
 *
 * @author Movitech Mobile
 * @since 2018-03-07
 */
@Service
public class SCommentConfigServiceImpl extends ServiceImpl<SCommentConfigMapper, SCommentConfig> implements SCommentConfigService {

    @Autowired
    private SCommentConfigMapper sCommentConfigMapper;

    @Override
    public String getValueByCode(String code) {
        SCommentConfig sCommentConfig = getByCode(code);
        if(sCommentConfig == null){
            return null;
        }
        return sCommentConfig.getConfigValue();
    }

    @Override
    public SCommentConfig getByCode(String code) {
        return sCommentConfigMapper.getByCode(code);
    }

    @Override
    public List<SCommentConfig> findSHistoryCommentByCode(SCommentConfigFindRequest request) {
        List<SCommentConfig> sCommentConfigs = sCommentConfigMapper.findSHistoryCommentByCode(request);
        return sCommentConfigs;
    }
}
